package com.ikm.demo.controller;

import com.google.gson.Gson;
import com.ikm.demo.entity.SysOrgPerson;
import com.ikm.demo.service.SysOrgPersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class SysOrgPerson2Controller {

    @Autowired
    private SysOrgPersonService sysOrgPersonService;

    @RequestMapping(value="/ikm/getJson",method = RequestMethod.GET)
    @ResponseBody
    public String getJson(){
        Gson gson = new Gson();
        List<SysOrgPerson> personList =  sysOrgPersonService.getPerson();
        return gson.toJson(personList);

    }

    @RequestMapping(value="/index",method = RequestMethod.GET)
    public String index(){
        return "index";

    }
}
